Walking the page lists needs the page_alloc lock
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 28 Jul 2010 06:54:12 +0000 (07:54 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 28 Jul 2010 06:54:12 +0000 (07:54 +0100)
commit4dff228603baee05a142af732a4131d36d620248
treeb278ccadc241d6f38e616a5b2341545c3819f33d
parent891c9ebad752ce367c9e639b8edb48aaba462338
Walking the page lists needs the page_alloc lock

There are a few places in Xen where we walk a domain's page lists
without holding the page_alloc lock.  They race with updates to the
page lists, which are normally rare but can be quite common under PoD
when the domain is close to its memory limit and the PoD reclaimer is
busy.  This patch protects those places by taking the page_alloc lock.

I think this is OK for the two debug-key printouts - they don't run
from irq context and look deadlock-free.  The tboot change seems safe
too unless tboot shutdown functions are called from irq context or
with the page_alloc lock held.  The p2m one is the scariest but there
are already code paths in PoD that take the page_alloc lock with the
p2m lock held so it's no worse than existing code.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
xen/arch/x86/domain.c
xen/arch/x86/mm/p2m.c
xen/arch/x86/numa.c
xen/arch/x86/tboot.c